﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;
using Kooboo.HtmlFunc.Function;
using Kooboo.HtmlFunc.Providers;

namespace Kooboo.HtmlFunc.Analysis.Visitors
{
    public class MenuItemVisitor : StartEndVisitor
    {
        public MenuItemVisitor(VisitorContext context)
            : base(context, FuncType.MenuItem)
        {
        }

        protected override object OnQualified(HtmlCommentNode startNode, HtmlCommentNode endNode)
        {
            var menu = (IMenu)this.Context.Items[FuncType.Menu];
            menu.ItemStartNode = startNode;
            menu.ItemEndNode = endNode;

            // ret context mark
            return menu;
        }

        protected override FuncType RequireType
        {
            get
            {
                return FuncType.Menu;
            }
        }

        protected override FuncType ExclusiveType
        {
            get
            {
                return this.FuncType;
            }
        }
    }
}
